package com.课上案例练习.线程.等待唤醒机制.虚假唤醒;

// 测试代码
public class Test1 {
    public static void main(String[] args) {
        FruitPrinter printer = new FruitPrinter();

        // 线程A：循环输出苹果
        new Thread(() -> {
            for (int i = 0; i < 3; i++) {
                try {
                    printer.printApple();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();

        // 线程B：循环输出香蕉
        new Thread(() -> {
            for (int i = 0; i < 3; i++) {
                try {
                    printer.printBanana();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }
}